package ast;

import java.util.ArrayList;

public class Procedure {

	private String name;
	private Site site;
	private ArrayList<ExpVar> params;
	private Process process;
	private Label beginLabel;
	
	public Procedure(String nm, Site st, 
			ArrayList<String> paramList, Process proc, Label bl)
	{
		name = nm;
		site = st;
		params = new ArrayList<ExpVar>();
		for (String str : paramList)
		{
			params.add(new ExpVar(str));
		}
		process = proc;
		beginLabel = bl;
	}
	
	public String getName()
	{
		return name;
	}
	
	public Process getProcess()
	{
		return process;
	}
	
	public ArrayList<ExpVar> getParams()
	{
		return params;
	}
	
	public void setProcess(Process p)
	{
		process = p;
	}
	
	public Site getSite()
	{
		return site;
	}
	
	public Label getBeginLabel() {
		return beginLabel;
	}
	
	public void setBeginLabel(Label bl)
	{
		beginLabel = bl;
	}

	public String toString(int indent)
	{
		String res = name + "@" + site + "(";
		for (int i = 0; i < params.size(); i++) {
			res += params.get(i);
			if (i != params.size() - 1)
				res += ", ";
		}
		res += ") as " + process.toString(0);
		
		
		return res;
	}
	
}
